<template>
  <div>

    <van-tabs @click="onClick">
      <van-tab v-for="(item) in arr" :key="item.id" :title="item.catename">
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import { reqhomecate } from "../../../http/http";
export default {
  data() {
    return {
      arr: [],
    };
  },
  methods: {
    onClick(index){
      this.$router.push('/list?id=' + this.arr[index].id)
    }
  },
  mounted() {
    reqhomecate().then((res) => {
      // console.log(res);
      this.arr = res.data.list;
      // console.log(this.arr);
    });
  },
};
</script>

<style>
</style>